package com.lwq.util;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/**
 * Description:
 * Author: LiuWenQing
 * Datetime: 2021/6/21
 */
public class ListUtil {

    public static List<String> removeFromList(String temp, List<String> list){
        List<String> reList = new ArrayList<>();
        for (String s : list) {
            if(!s.equals(temp)){
                reList.add(s);
            }
        }
        return reList;
    }

    public static List<String> removeFromList2(String temp, List<String> list){
        Iterator<String> iterator = list.iterator();
        while(iterator.hasNext()){
            if(iterator.next().equals(temp)){
                iterator.remove();
            }
        }
        return list;
    }
}
